import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import rem from './utils/rem'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
// import  axios from 'axios'
import  axios from './utils/http';
import './assets/font_wsx/iconfont.css'
// axios.defaults.baseURL = '/api';
import baiduMap from 'vue-baidu-map';



Vue.prototype.axios  =  axios
    //login新增部分
router.beforeEach((to, from, next) => {
        if (to.meta.isNeedLogin) {
            // console.log('store.state.loginmodule.user.username')
            console.log(store.state.loginmodules)
                // console.log('store.state.loginmodule.user.username')
                // console.log(store.state.loginmodules)

            if (store.state.loginmodules.user.admin_name) {
                //判断是否登录
                next()
            } else {
                router.push('/Login')
            }
        } else {
            /*   console.log('不需要登录的界面from');
              console.log(from)
              console.log('不需要登录的界面to');
              console.log(to) */
            /*    if(to.path==='/Login'){
                   if(from.meta.isNeedLogin){
                       router.push('/LoginTips')
                   }else{
                       next()
                   }

               } */
            next()
        }
    })
    //     ////login新增结束
Vue.use(ElementUI);
Vue.use(baiduMap, {
    ak: 'pYB4gXPSXVA9tdKjDiGGXRjct7wMs6FF'
})
Vue.config.productionTip = false
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')